<?php

class ReturnHelper
{
    public static function bundle($data, $msg, $state): array {
        return [
            "state" => $state,
            "msg" => $msg,
            "data" => $data
        ];
    }

    public static function success($data, $msg, $state=200): array {
        return self::bundle($data, $msg, $state);
    }

    public static function failed($data, $msg, $state=400): array {
        return self::bundle($data, $msg, $state);
    }

    public static function response($arrayData) {
        echo json_encode($arrayData);
    }
}